package com.msh.starter.email.config;

import com.msh.frame.client.interfaces.IClassLoadLog;
import com.msh.starter.email.instance.SimpleEmailSend;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
@ConditionalOnProperty(value = "msh.starter.email.enable", havingValue = "true", matchIfMissing = true)
public class EmailAutoConfiguration implements IClassLoadLog {

  @Bean
  public SimpleEmailSend simpleEmailSend(){
    return new SimpleEmailSend();
  }

  @Override
  public String logInfo() {
    StringBuilder sb = new StringBuilder().append("----执行类 ")
        .append(EmailAutoConfiguration.class)
        .append("\r\n")
        .append("--------加载类 ")
        .append(SimpleEmailSend.class)
        .append("\r\n");
    return sb.toString();
  }
}
